package com.liqi.frame.comm.config;

import com.liqi.frame.comm.directive.BaseUrlDirective;
import com.liqi.frame.comm.directive.HasPermissionDirective;
import freemarker.template.Configuration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * 指令配置
 * Created by liqi on 2019/9/23 0023.
 */
@Component
public class DirectiveConfig {
    @Autowired
    private Configuration configuration;
    @Autowired
    private BaseUrlDirective baseUrlDirective;
    @Autowired
    private HasPermissionDirective hasPermissionDirective;

//    项目启动就执行
    @PostConstruct
    public void setSharedVariable() {
        configuration.setSharedVariable("baseUrl", baseUrlDirective);
        configuration.setSharedVariable("hasPermission", hasPermissionDirective);
    }
}
